using MicroMsg.Common.Utils;
using MicroMsg.Resource.@string;
using MicroMsg.Scene;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using Microsoft.Phone.Tasks;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
namespace MicroMsg.UI.Page
{
	public class AboutMMPage : BasePage
	{
		private UpdateInfo m_UpdateInfo;
		internal Grid LayoutRoot;
		internal StackPanel ContentPanel;
		internal Button btnSeeWhatsnew;
		internal Image image1;
		internal TextBlock txtDesc;
		internal Button btnUpdateVersion;
		internal ClickableLayout textPhone;
		internal TextBlock txtTel;
		private bool _contentLoaded;
		public AboutMMPage()
		{
			this.InitializeComponent();
		}
		protected override void OnPageIn(object[] object_0)
		{
			if (object_0 != null && object_0.Length > 0)
			{
				this.m_UpdateInfo = (object_0[0] as UpdateInfo);
			}
			this.initData();
		}
		protected override void OnPageOut()
		{
		}
		private void initData()
		{
			Run run = this.txtTel.get_Inlines().get_Item(0) as Run;
			run.set_Text(strings.Set_AboutMM_ServiceTel + ": ");
			if (this.m_UpdateInfo != null)
			{
				this.btnUpdateVersion.set_Content(strings.Set_AboutMM_Update);
				this.btnUpdateVersion.set_Visibility(0);
				this.txtDesc.set_Text(this.m_UpdateInfo.PackDescription);
			}
		}
		private void btnUpdateVersion_Click(object sender, RoutedEventArgs e)
		{
			if (this.m_UpdateInfo != null)
			{
				string text = (this.m_UpdateInfo.PackSize * 1.0 / 1048576.0).ToString();
				int num = (text.get_Length() > 3) ? 3 : text.get_Length();
				text = text.Substring(0, num);
				MMMessageBox mMMessageBox = MMMessageBox.Show(strings.Set_AboutMM_HasNewVersion, string.Concat(new string[]
				{
					this.m_UpdateInfo.PackDescription,
					"\r\n",
					strings.Set_AboutMM_PackageSize,
					text,
					"MB"
				}), true, strings.Set_AboutMM_Update, strings.COM_Cancel);
				mMMessageBox.ReturnEvent = new DlgReturnEvent(this.updateInfoDlgReturn);
			}
		}
		private void textPhoneClick(object sender, RoutedEventArgs e)
		{
			PhoneCallTask phoneCallTask = new PhoneCallTask();
			phoneCallTask.set_PhoneNumber("86075561369988");
			phoneCallTask.set_DisplayName(strings.Set_AboutMM_ServiceTel);
			phoneCallTask.Show();
		}
		public void updateInfoDlgReturn(DlgReturnEventArg dlgReturnEventArg_0)
		{
			switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
			{
			case -1:
				Log.smethod_5("AboutMMPage", "cancel update");
				return;
			case 0:
				this.startUpdate();
				return;
			case 1:
				Log.smethod_5("AboutMMPage", "cancel update");
				return;
			default:
				return;
			}
		}
		private void startUpdate()
		{
			Log.smethod_5("AboutMMPage", "begin update");
			Util.doUpdateApp();
			Log.smethod_7();
			App.ExitProgram();
		}
		private void btnSeeWhatsnew_Click(object sender, RoutedEventArgs e)
		{
			WhatsNew.ShowWhatsNew(WhatsNewKind.JustSeeIt);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Setting/AboutMMPage.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.ContentPanel = (StackPanel)base.FindName("ContentPanel");
			this.btnSeeWhatsnew = (Button)base.FindName("btnSeeWhatsnew");
			this.image1 = (Image)base.FindName("image1");
			this.txtDesc = (TextBlock)base.FindName("txtDesc");
			this.btnUpdateVersion = (Button)base.FindName("btnUpdateVersion");
			this.textPhone = (ClickableLayout)base.FindName("textPhone");
			this.txtTel = (TextBlock)base.FindName("txtTel");
		}
	}
}
